package com.kzw.oa.action.info;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.kzw.core.web.action.BaseAction;
import com.kzw.oa.model.info.InMessage;
import com.kzw.oa.model.info.ShortMessage;
import com.kzw.oa.service.info.InMessage2Service;
import com.kzw.oa.service.info.MessageService;
import com.kzw.oa.util.JSON;

@Controller
@Scope("prototype")
public class MessageAction extends BaseAction {

	@Autowired
	private MessageService messageService;
	@Autowired
	private InMessage2Service inMessage2Service;
	
	private ShortMessage message;
	private Long id;

	public String getShortMsg() {
		ShortMessage message = messageService.get(id);
		setJsonString(new JSON(message).buildWithFilters(2));
		return SUCCESS;
	}
	
	public String getInMsg() {
		InMessage message = inMessage2Service.get(id);
		setJsonString(new JSON(message).buildWithFilters(2));
		return SUCCESS;
	}
	
	public ShortMessage getMessage() {
		return message;
	}

	public void setMessage(ShortMessage message) {
		this.message = message;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

}
